package com.picshare.model;

import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class ApiKey {
    private String key;
    private String description;
    private String username;
    private long createdAt;
    private long lastUsed;
    private boolean active;
    
    public ApiKey(String username, String description) {
        this.key = generateApiKey();
        this.description = description;
        this.username = username;
        this.createdAt = System.currentTimeMillis();
        this.lastUsed = 0;
        this.active = true;
    }
    
    private String generateApiKey() {
        return "pk_" + java.util.UUID.randomUUID().toString().replace("-", "");
    }
}